﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using GiaPhuc.Data;

namespace GiaPhuc.Pages
{
    public partial class TopicPage : System.Web.UI.Page
    {
        private int PageID
        {
            get
            {
                if (null != Request["ID"])
                {
                    return int.Parse(Request["ID"]);
                }
                return 0;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                using (IDbConnection connection = new MySql.Data.MySqlClient.MySqlConnection(Helper.ConnectionString))
                {
                    using (ResellEraDMInPhUkIeNipAdX context = new ResellEraDMInPhUkIeNipAdX(connection))
                    {
                        int pageID = PageID;
                        var page = context.EZPages.SingleOrDefault(x => x.PagesID == pageID);
                        if (null != page)
                        {
                            this.Title = String.Concat("CỬA HÀNG TINH TẾ (NICE STORE) - PHỤ KIỆN IPAD - ", page.PagesTitle);
                            divContent.InnerHtml = page.PagesHTMLText.RemoveBadCode();
                        }
                    }
                }
            }
        }
    }
}